from django.contrib import admin
from django.urls import path, include
from . import views

urlpatterns = [
    #
    # path('book/', views.BookModelViewSet.as_view({'get': 'list', 'post': 'create'})),
    # path('book/<int:pk>', views.BookModelViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    # path('book/bread', views.BookModelViewSet.as_view({'get': 'bread_book'})),
    # path('book/update_book_bread/<int:pk>', views.BookModelViewSet.as_view({'put': 'update_book_bread'})),
]

from rest_framework.routers import SimpleRouter,DefaultRouter
#1.创建路由对象
router = SimpleRouter()
# 2.注册视图集
router.register('book',views.BookModelViewSet,base_name='haha')
urlpatterns +=router.urls
# ３.输出结果
print(urlpatterns)
